package cn.diancan.util;

import cn.diancan.model.GoodsCategory;
import cn.diancan.service.GoodsCategoryService;
import cn.diancan.util.spring.SpringContextUtil;

/**
 * @author Sky
 */
public class GoodsCategoryUtils {


    public static Long lengpan = 0L;
    public static Long jiushui = 0L;
    public static Long canju = 0L;

    static {
        GoodsCategoryUtils.load();
    }

    public static void load(){
        GoodsCategoryService goodsCategoryService = (GoodsCategoryService)SpringContextUtil.getBean("goodsCategoryService");

        try {
            GoodsCategory lengpanCategory = goodsCategoryService.findByGoodsCategoryName("冷盘");
            lengpan=lengpanCategory.getId();
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            GoodsCategory jiushuiCategory = goodsCategoryService.findByGoodsCategoryName("酒水");
            jiushui=jiushuiCategory.getId();
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {

            GoodsCategory canjuCategory = goodsCategoryService.findByGoodsCategoryName("餐具");
            canju=canjuCategory.getId();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }



}
